var insertKeyStr = "Key 값을 입력하세요.";
var insertValueStr = "Value 값을 입력하세요.";

function init() {
	_initHeader();
	
	var array = new Array();
	
	array.push("contains");
	array.push("get");
	array.push("put");
	array.push("remove");
	
	draw_list(array);
}

function setOnListClickHandler(idx) {
	switch(idx) {
		case 0 :
			testContains();
			
		break;
		
		case 1 :
			testGet();
			
		break;
		
		case 2 :
			testPut();
			
		break;
		
		case 3 :
			testRemove();
			
		break;
		
		default :

		break;
	}
}

function testContains() {
	var key = prompt(insertKeyStr, "testKey");
	
	if(key)
		alert(globalPreference.contains(key));
}

function testGet() {
	var key = prompt(insertKeyStr, "testKey");
	
	if(key)
		alert(globalPreference.get(key));
}

function testPut() {
	var key = prompt(insertKeyStr, "testKey");
	if(key == null)
		return;
	
	var value = prompt(insertValueStr, "testValue");
	if(value == null)
		return;
	
	globalPreference.put(key, value);
	notifySuccess("put");
}

function testRemove() {
	var key = prompt(insertKeyStr, "testKey");
	
	if(key) {
		globalPreference.remove(key);
		notifySuccess("remove");
	}
}